import request from '@/utils/request'

/**
 * 查询参数
 */
export const getEmployeeListApi = (params) => {
  return request.get('/sys/user', { params }) // 地址参数 查询参数
}

/**
 * 导出员工的excel
 **/

export const exportEmployeeApi = () => {
  return request.get('/sys/user/export', {
    // 改变接收数据的类型
    responseType: 'blob' // 使用blob接收二进制文件流
  })
}

/**
 * 下载员工导入模版
 * **/

export const getExportTemplateApi = () => {
  return request.get('/sys/user/import/template', {
    responseType: 'blob' // 二进制文件流
  })
}

/**
 * 上传用户的excel
 *
*/
export const uploadExcelApi = (data) => {
  return request.post('/sys/user/import', data)// form-data类型 因为要上传文件类型
}

/**
 * 删除员工
 * **/

export const delEmployeeApi = (id) => {
  return request.delete(`/sys/user/${id}`)
}
/**
 * 新增员工
 * **/
export const addEmployeeApi = (data) => {
  return request.post('/sys/user', data)
}

/**
 *  获取员工详情
 * **/

export const getEmployeeDetailApi = (id) => {
  return request.get(`/sys/user/${id}`)
}

export const updateEmployeeApi = (data) => {
  return request.put(`/sys/user/${data.id}`, data)
}

// 群发通知接口
export const sendMultiMessageApi = (data) => {
  return request.post('/sys/messageMuch', data)
}

// 获取用户消息
export const getUserMessageApi = () => {
  return request.get('/sys/message')
}
// 删除用户信息
export const delUserMessageApi = (id) => {
  return request.delete(`/sys/message/${id}`)
}
// 已读消息
export const updateUserMessageApi = (id) => {
  return request.put(`/sys/message/${id}`)
}
